package com.weiiew.buildservice.annotation;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Caching;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @Description
 * @Author 魏锴
 * @Date 2025/4/6
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Caching(evict = {
        @CacheEvict(cacheNames = "build:one", key = "#id", condition = "#id != null "),
        @CacheEvict(cacheNames = "build:vo", key = "#id", condition = "#id != null "),
        @CacheEvict(cacheNames = "build:list", key = "#version + '*'", cacheManager = "fuzzyCacheManager"),
        @CacheEvict(cacheNames = "build:length", key = "#version + '*'", cacheManager = "fuzzyCacheManager"),
        @CacheEvict(cacheNames = "build:list:simple", key = "#version + '*'", cacheManager = "fuzzyCacheManager"),
        @CacheEvict(cacheNames = "build:list:type:simple", key = "#version"),
        @CacheEvict(cacheNames = "build:list:cost", key = "#version"),
        @CacheEvict(cacheNames = "build:list:icon", key = "#version"),
        @CacheEvict(cacheNames = "build:list:cost", allEntries = true),
})
public @interface BuildChangeCacheEvict {
}
